<include file="public:top" />
<!--编辑菜单-->
<fieldset class="layui-elem-field layui-field-title">
    <legend>编辑企业 - {$info.title}</legend>
</fieldset>
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
  <input type="hidden" name="img" id="J_img" value="{$info.img}">
  <input type="hidden" value="{$menuid}" name="menuid">
    <div class="layui-form-item" id="slide_image">
      <label class="layui-form-label">企业图片</label>
      <div class="layui-input-block">
         <button type="button" name="img1" class="layui-btn layui-btn-primary" id="upimg"><i class="layui-icon"></i>只允许图片文件</button>
         <div class="layui-form-mid " style="width: 100%"><img src="" height="36" id="imgval" style="max-width:450px;display: none;"></div>
      </div>

    </div>

   <div class="layui-form-item">
      <label class="layui-form-label">名称</label>
      <div class="layui-input-block">
        <input type="text" name="title" required lay-verify="required" placeholder="必填内容" class="layui-input" value="{$info.title}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">所在地区</label>
      <div class="layui-input-block">
        <select name="cate_id">
          <option value="" >请选择</option>
          <volist name="catelist" id="v" >
           <option value="{$v.id}" <if condition="$info['cate_id'] eq $v['id']">selected="selected"</if>>{$v.name}</option>
        </volist>
       </select>
      </div>
    </div>
   
    <div class="layui-form-item">
      <label class="layui-form-label">电话</label>
      <div class="layui-input-block">
        <input type="number" name="tel" required lay-verify="required" placeholder="必填内容" class="layui-input" value="{$info.tel}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">联系人</label>
      <div class="layui-input-block">
        <input type="text" name="lianxiren" required lay-verify="required" placeholder="必填内容" class="layui-input" value="{$info.lianxiren}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">邮箱</label>
      <div class="layui-input-block">
        <input type="text" name="email" required lay-verify="required" placeholder="必填内容" class="layui-input" value="{$info.email}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">网址</label>
      <div class="layui-input-block">
        <input type="text" name="url" required lay-verify="required" placeholder="必填内容" class="layui-input" value="{$info.url}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">公司地址</label>
      <div class="layui-input-block">
        <input type="text" name="contact" required lay-verify="required" placeholder="必填内容" class="layui-input" value="{$info.contact}">
      </div>
    </div>

    <div class="layui-form-item" pane>
    <label class="layui-form-label">企业认证</label>
    <div class="layui-input-block">
      <input type="radio" name="renzheng" value="1" title="{:L('yes')}" <if condition="$info.renzheng eq 1"> checked="checked"</if>>
      <input type="radio" name="renzheng" value="0" title="{:L('no')}" <if condition="$info.renzheng eq 0"> checked="checked"</if>>
    </div>
  </div>

   
 
<input type="hidden" value="{$info.id}" name="id">
<input type="hidden" value="{$menuid}" name="menuid">
  <div class="layui-form-item">
        <button class="layui-btn" lay-submit="" lay-filter="content_edit">立即提交</button>
        <a class="layui-btn layui-btn-primary" onClick="history.go(-1)">返回</a>
    </div>
</form>
<script type="text/javascript" src="__PUBLIC__/admin/layui/layui.js"></script>
<script>
//Demo
layui.use(['layer','jquery','form','upload'], function () {
    // 操作对象
    var layer = layui.layer,$ = layui.jquery,form = layui.form, upload = layui.upload;
    
    //判断是否有图片
    var  str='{$info.img}';
    if (str !== '') {
      $('#imgval').show().attr('src','{:upload($info[\'img\'], \'txl\')}'); 

    }

   //上传图片
    upload.render({
    elem: '#upimg'
    ,url: "{:U('txl/ajax_upload_img')}"
    ,field:'img'
    ,acceptMime: 'image/*'
    ,done: function(res, index, upload){
      if (res.status == 1) {
        layer.msg('上传成功',{time:1800});
        var path = "{$img_dir}" + res.info;
        $('#J_img').val(res.info);
        $('#imgval').show().attr('src',path); 
      }else {
        layer.msg('上传失败',{time:1800});
      }
    }
  }); 


   Oper.initUpdate(layui, '企业名录', 'content_edit', 'txl/edit');

});
</script>
</body>
</html>